﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ParsecParser.Communication
{
    [Serializable]
    public class ArchiveFightRequest
    {
        public string UserName { get; set; }
        public string Password { get; set; }
        public string RaidGroup { get; set; }
        public string RaidGroupPassword { get; set; }
        public string FightLog { get; set; }
        public int GuardCount { get; set; }
        public string CharacterName { get; set; }
        //public CombatDetails Fight { get; set; }
        public int? OverrideRaidEncounterMode { get; set; }
        public int? OverrideRaidEncounterPlayers { get; set; }
        public ArchiveFightRequest()
        {
            //Fight = new CombatDetails();
        }
        public CombatDetails GetFight()
        {
            CombatLog l = new CombatLog(new ParsecParser.Parser());
            l.CurrentLogState.CharacterName = CharacterName;
            l.CurrentLogState.GuardCount = GuardCount;
            string[] s = new string[] { Environment.NewLine };
            bool containsStartEvent = false;
            var e = l.AddLines(FightLog.Split(s, StringSplitOptions.None).ToList(), out containsStartEvent);
            if (l.LastFightIndex > 0)
                return l.GetFight(l.LastFightIndex);
            else
                return null;
        }
    }
}
